using System.Collections.Generic;
using System.Data;

namespace DL
{
    public class DP_Activity : DataParser
    {
        public override string GetLocalCsvName() => "游戏常规数据 - 活动信息";

        public override void DoParse(DataTable table)
        {
            var dataList = new List<object>();
            var totalRow = table.Rows.Count;
            for (int i = 3; i < totalRow; i++)
            {
                var id = table.Rows[i][0].ToString();
                if (string.IsNullOrEmpty(id))
                {
                    continue;
                }

                var data = new Dictionary<string, object>();
                var name = table.Rows[i][1].ToString();
                var st = table.Rows[i][2].ToString();
                var et = table.Rows[i][3].ToString();
                data.Add(nameof(id), id);
                data.Add(nameof(name), name);
                data.Add(nameof(st), st);
                data.Add(nameof(et), et);
                dataList.Add(data);
            }

            var json = MiniJson.Json.Serialize(dataList);
            json = MakeJsonEasyToRead(json);

            WriteFile(json, "Activity.json");
        }
    }
}
